package com.cskaoyan.shopping.converter;

import com.cskaoyan.shopping.dal.entitys.Category;
import com.cskaoyan.shopping.dto.CategoryDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

/**
 * @Description:
 * @Author llf
 * @Date 2022/6/19 15:09
 */
@Mapper(componentModel = "spring")
public interface CategoryConverter {
    @Mappings({
            @Mapping(source = "id", target = "id"),
            @Mapping(source = "icon", target = "iconUrl"),
            @Mapping(source = "isParent", target = "isParent"),
            @Mapping(source = "name", target = "name"),
            @Mapping(source = "parentId", target = "parentId")
    })
    CategoryDto CategoryToDto(Category category);

    List<CategoryDto> ListCategoryToDto(List<Category> categories);
}
